<template>
  <button @click="sendDataToParent">发送数据给父组件</button>
</template>

<script setup>

import {onMounted} from "vue";

const emit = defineEmits(['custom-event'])

function sendDataToParent() {
  emit('custom-event', '返回数据3')
}

emit('custom-event', '返回数据1')

onMounted(() => {
  emit('custom-event', '返回数据2')
})
</script>

<style scoped>

</style>
